package com.zllkj.mm.adapter

import android.util.Log
import android.view.View
import androidx.appcompat.widget.AppCompatImageView
import androidx.appcompat.widget.AppCompatTextView
import androidx.appcompat.widget.LinearLayoutCompat
import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.BaseViewHolder
import com.zllkj.mm.R
import com.zllkj.mm.common.ClientConfig
import com.zllkj.mm.model.entity.FreeTimeOrderVoRecord
import com.zllkj.mm.model.entity.WaitToConfirmOrderVoRecord
import com.zllkj.mm.model.entity.WriteOffFreeTimeHistoryListVoRecord
import com.zllkj.mm.module.goods.vm.ItemCollectionsVM
import com.zllkj.mm.module.shopping.vm.ItemAfterSaleListVM
import com.zllkj.mm.util.common.FormatUtil
import com.zllkj.mm.util.common.PictureLoadUtil
import java.math.BigDecimal

class FreeTimeConfirmHistoryListAdapter(layoutResId: Int, data: List<WriteOffFreeTimeHistoryListVoRecord?>?) :
        BaseQuickAdapter<WriteOffFreeTimeHistoryListVoRecord, BaseViewHolder>(layoutResId, data) {
    override fun convert(baseViewHolder: BaseViewHolder, vm: WriteOffFreeTimeHistoryListVoRecord) {
        vm?.let {
            var ivHead = baseViewHolder.getView<AppCompatImageView>(R.id.ivhead)
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_itme_freetime_order_id).text = it.orderNo
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_item_freetime_inviter_name).text = it.invitationUserNikeName
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_item_freetime_inviter_topic).text = "话题:" + it.topic
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_item_freetime_inviter_time_content).text = it.startTime + "---" + it.endTime
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_item_freetime_inviter_time_money).text = "收入" +  FormatUtil.bigDecimalUtilFormat(it.totalFee.toString(),"100")
            PictureLoadUtil.loadPic(baseViewHolder.getView<AppCompatImageView>(R.id.iv_item_freetime_history),it.pic)
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_item_freetime_inviter_time_status).text = "" + when(it.cancelled){
                0 -> "已完成"
                1 -> "用户发起取消"
                2 -> "闲时用户取消"
                3 -> "超时取消"
                else -> "未知"
            }
            baseViewHolder.getView<AppCompatTextView>(R.id.tv_item_freetime_inviter_time_verification_way).text = "收入" +  FormatUtil.bigDecimalUtilFormat(it.totalFee.toString(),"100")
        }

    }
}